package org.colafries.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author colafries
 * @version v1.0
 * @ClassName DataModelTypeEnum
 * @Description
 * @date Created in 2024/3/25
 **/
@Getter
@AllArgsConstructor
public enum ColumnTypeEnum {
    DIMENSION(1, "dimension"),
    MEASURE(2, "measure"),
    OTHER(999,"other");

    @EnumValue
    private final Integer code;
    private final String value;

    public static ColumnTypeEnum get(Integer code){
        for (ColumnTypeEnum dataTypeEnum : ColumnTypeEnum.values()){
            if (dataTypeEnum.getCode().equals(code)){
                return dataTypeEnum;
            }
        }
        return ColumnTypeEnum.OTHER;
    }
}
